package utils

import (
	"regexp"
	"strings"
)

//{"account":"a1","role":"r1","creator":"c1","create_time":"...","last_time":"..."}
func Jsonstr2Map(str string) map[string]string {
	m := make(map[string]string)
	reg, err := regexp.Compile("\"(.+?)\"")
	if err == nil {
		ss := reg.FindAllString(str, -1)
		for i := 0; i < len(ss); i += 2 {
			m[strings.ReplaceAll(ss[i], "\"", "")] = strings.ReplaceAll(ss[i+1], "\"", "")
		}
	}
	return m
}
